package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCIdentifiablePhysicalProductEntry;
import com.shrct.businessprocess.product.RCLogicProduct;
import com.shrct.businessprocess.product.RCRMABorrowReplacementEvent;
import com.shrct.businessprocess.product.impl.RCIdentifiablePhysicalProductEntryImpl;
import com.shrct.businessprocess.product.impl.RCRMAEventImpl;
import com.shrct.businessprocess.product.proxy.RCRMABorrowReplacementEventProxy;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCRMABORROWREPLACEMENTEVENT_TYPE")
public class RCRMABorrowReplacementEventImpl extends RCRMAEventImpl implements RCRMABorrowReplacementEvent {
  public RCRMABorrowReplacementEventImpl() {
    super();
  }
  
  public RCRMABorrowReplacementEventImpl(final RCLogicProduct logicProduct) {
    super( logicProduct);
    
  }
  
  @JoinColumn(name = "fromProduct_id")
  @ManyToOne(targetEntity = RCIdentifiablePhysicalProductEntryImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCIdentifiablePhysicalProductEntry fromProduct;
  
  public RCIdentifiablePhysicalProductEntry getFromProduct() {
    return this.fromProduct;
  }
  
  public RCRMABorrowReplacementEvent setFromProduct(final RCIdentifiablePhysicalProductEntry fromProduct) {
    this.fromProduct = fromProduct;
    return this;			
    
  }
  
  @JoinColumn(name = "toProduct_id")
  @ManyToOne(targetEntity = RCIdentifiablePhysicalProductEntryImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCIdentifiablePhysicalProductEntry toProduct;
  
  public RCIdentifiablePhysicalProductEntry getToProduct() {
    return this.toProduct;
  }
  
  public RCRMABorrowReplacementEvent setToProduct(final RCIdentifiablePhysicalProductEntry toProduct) {
    this.toProduct = toProduct;
    return this;			
    
  }
  
  public String getEventTitle() {
    return "\u66FF\u4EE3\u8BBE\u5907RMA\uFF08\u501F\u5165\uFF09";
  }
  
  public String getDescription() {
    String _sid = this.fromProduct.getSid();
    String _plus = ("\u66FF\u4EE3\u8BBE\u5907RMA\uFF0C\u501F\u5165\u8BBE\u5907:" + _sid);
    String _plus_1 = (_plus + ",\u65B0\u8BBE\u5907:");
    String _sid_1 = this.toProduct.getSid();
    String _plus_2 = (_plus_1 + _sid_1);
    return _plus_2;
  }
  
  public static RCRMABorrowReplacementEvent create(final RCLogicProduct logicProduct, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.product.RCRMABorrowReplacementEvent rCRMABorrowReplacementEvent = new com.shrct.businessprocess.product.impl.RCRMABorrowReplacementEventImpl(
    	logicProduct
    );
    objectFactory.create(rCRMABorrowReplacementEvent);
    return rCRMABorrowReplacementEvent;			
    
  }
  
  public static RCRMABorrowReplacementEvent createRCRMABorrowReplacementEventImpl(final RCLogicProduct logicProduct, final IObjectFactory objectFactory, final Procedure1<RCRMABorrowReplacementEvent> init) {
    com.shrct.businessprocess.product.RCRMABorrowReplacementEvent rCRMABorrowReplacementEvent = new com.shrct.businessprocess.product.impl.RCRMABorrowReplacementEventImpl(
    	logicProduct
    );
    objectFactory.create(rCRMABorrowReplacementEvent);
    init.apply(rCRMABorrowReplacementEvent);
    
    return rCRMABorrowReplacementEvent;			
    
  }
  
  public RCRMABorrowReplacementEventProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCRMABorrowReplacementEventProxy proxy = new com.shrct.businessprocess.product.proxy.RCRMABorrowReplacementEventProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
